{template 'web/_header'}
<ul class="nav nav-tabs">
    <li {if ($_GPC['p'] == 'list' || $_GPC['p'] == '') && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('experience/list')}">体验券</a></li>
    <li {if $_GPC['p'] == 'list' && $_GPC['op'] == 'record'}class="active"{/if}><a href="{php echo $this->createWebUrl('experience/list',array('op'=>'record'))}">全部领取记录</a></li>
    <li {if $_GPC['p'] == 'list' && $_GPC['op'] == 'paylog'}class="active"{/if}><a href="{php echo $this->createWebUrl('experience/list',array('op'=>'paylog'))}">支付记录</a></li>
</ul>
{if $operation == 'display'}
<form action="" method="post">
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:5%">ID</th>
                    <th style="width:5%">小店MID</th>
                    <th style="width:10%">掌柜</th>
                    <th style="width:5%">样式图片</th>
                    <th style="width:10%">体验店名称</th>
                    <th style='width:10%'>体验项目</th>
                    <th style='width:5%'>总张数</th>
                    <th style="width:5%">已领张数</th>
                    <th style="width:5%">已使用</th>
                    <th style='width:5%'>价值</th>
                    <th style='width:5%'>支付金额</th>
                    <th style='width:15%'>使用期限</th>
                    <th style="width:10%">创建时间</th>
                    <th style="width:10%">地点</th>
                    <th style="width:5%">领取记录</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>
                    <td style="width:5%">{$row['id']}</td>
                    <td style="width:5%">{$row['mid']}</td>
                    <td><img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
                    <td style='width:10%'><img src='http://wx.lanxuevip.com/attachment/{$row['tupian']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc'></td>
                    <td style='width:10%'>{$row['shopname']}</td>
                    <td style='width:10%'>{$row['title']}</td>
                    <td style='width:10%'>{$row['num']}张</td>
                    <td style='width:10%'>{$row['receive_num']}张</td>
                    <td style='width:10%'>{$row['usetotal']}张</td>
                    <td style='width:10%'>{$row['money']}元</td>
                    <td style='width:10%'>{if $row['cash']==0}免费{else}{$row['cash']}元{/if}</td>
                    <td style='width:10%'>{$row['starttime']}~{$row['endtime']}</td>
                    <td style='width:10%'>{$row['createtime']}</td>
                    <td style='width:20%'>{$row['address']}</td>
                    <td style='width:10%'><a href="{php echo $this->createWebUrl('experience/list',array('op'=>'record','record_id'=>$row['id']))}" class="btn btn-default btn-sm tmp-unselect" data-original-tatle title>领取记录</a></td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
{elseif $operation == 'record'}
     <form action="" method="post">
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:5%;">体验券ID</th>
                    <th style="width:10%;">编码</th>
                    <th style='width:10%'>粉丝</th>
                    <th style='width:10%'>项目名称</th>
                    <th style="width:5%;">支付金额</th>
                    <th style='width:10%'>微信号</th>
                    <th style='width:10%'>手机号码</th>
                    <th style='width:5%'>性别</th>
                    <th style='width:10%'>领取时间</th>
                    <th style='width:10%'>使用时间</th>
                    <th style='width:5%'>是否使用</th>
                </tr>
            </thead>
            <tbody>
                {loop $record $row}
                <tr>
                    <td>{$row['experienceid']}</td>
                    <td>{$row['ordersn']}</td>
                    <td><img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
                    <td>{$row['title']}</td>
                    <td>{if $row['price']==0}免费{else}{$row['price']}元{/if}</td>
                    <td>{$row['weixin']}</td>
                    <td>{$row['mobile']}</td>
                    <td>
                     {if $row['gender']==1}
                      男
                      {else}
                      女
                      {/if}
                    </td>
                    <td>{$row['createtime']}</td>
                    <td>{$row['usetime']}</td>
                    <td>
                       {if $row['isuse'] ==0}
                       未使用
                       {else}
                       已使用
                       {/if}
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
<script>
    require(['bootstrap'], function ($) {
        $('.btn').hover(function () {
            $(this).tooltip('show');
        }, function () {
            $(this).tooltip('hide');
        });
    });
</script>
{elseif $operation == 'paylog'}
     <form action="" method="post">
<div class="panel panel-default">
    <div class="panel-body table-responsive">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr>
                    <th style="width:10%;">编码</th>
                    <th style='width:10%'>粉丝</th>
                    <th style="width:10%;">支付金额</th>
                    <th style='width:10%'>微信号</th>
                    <th style='width:10%'>手机号码</th>
                    <th style='width:10%'>支付类型</th>
                    <th style='width:10%'>支付时间</th>
                </tr>
            </thead>
            <tbody>
                {loop $record $row}
                <tr>
                    <td>{$row['tid']}</td>
                    <td><img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' /> {$row['nickname']}</td>
                    <td>{$row['fee']}元</td>
                    <td>{$row['weixin']}</td>
                    <td>{$row['mobile']}</td>
                    <td>
                        {if $row['type']=="wechat"}
                        <span class="label label-success">微信支付</span>
                        {/if}
                        {if $row['type']=="unionpay"}
                        <span class="label label-warning">银联支付</span>
                        {/if}
                    </td>
                    <td>{$row['paytime']}</td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>
</div>
</form>
<script>
    require(['bootstrap'], function ($) {
        $('.btn').hover(function () {
            $(this).tooltip('show');
        }, function () {
            $(this).tooltip('hide');
        });
    });
</script>
{/if}
{template 'web/_footer'}